Skip to content

Darwin: alias off64_t to off_t in NATIVE_LARGE_FILES block#788

Closed
jverkoey wants to merge 1 commit intodrolbr:masterfrom
ClutchEngineering:pr-darwin-off64-alias
Closed

Darwin: alias off64_t to off_t in NATIVE_LARGE_FILES block#788
jverkoey wants to merge 1 commit intodrolbr:masterfrom
ClutchEngineering:pr-darwin-off64-alias

Conversation

@jverkoey
Copy link
Copy Markdown

@jverkoey jverkoey commented Apr 19, 2026

The existing #ifdef NATIVE_LARGE_FILES block in src/template_db/types.h aliases ftruncate64, lseek64, and open64 so osm-3s can build against platforms without glibc's *64 symbols (notably macOS).

The off64_t type is still referenced — by Raw_File::size, Raw_File::resize, Raw_File::seek — so the block alone isn't sufficient on Darwin. Apple clang fails with:

error: unknown type name 'off64_t'; did you mean 'off_t'?

Adding typedef off_t off64_t; to the same guarded block finishes the job. off_t is 64-bit on all 64-bit Darwin targets, so this is semantically identical to the symbols the block already aliases.

Activate via CPPFLAGS="-DNATIVE_LARGE_FILES" at configure time (unchanged).

Two companion PRs address other Darwin-specific issues I hit while running Overpass natively on Apple Silicon — separate so they can be reviewed independently: #789 (sun_len fix), #790 (Mmap → pread).

template_db/types.h has a #ifdef NATIVE_LARGE_FILES block that aliases
ftruncate64/lseek64/open64 to their un-suffixed counterparts for
platforms where glibc's *64 symbols aren't available (notably macOS).
The off64_t type itself is still referenced by Raw_File::size(),
Raw_File::resize(), Raw_File::seek(), so the block isn't sufficient to
compile on Darwin -- Apple clang fails with:

  error: unknown type name 'off64_t'; did you mean 'off_t'?

Adding a 'typedef off_t off64_t;' to the same guarded block fixes the
build on macOS. off_t is 64-bit on all 64-bit Darwin targets, so this
is semantically identical to the symbols the block already aliases.

Activate via CPPFLAGS="-DNATIVE_LARGE_FILES" at configure time.
@jogemu
Copy link
Copy Markdown

jogemu commented Apr 21, 2026

There is already #763, which uses #define to keep aliasing consistent throughout the repository. It is worth considering typedef, but then update it everywhere at once.

@jverkoey
Copy link
Copy Markdown
Author

Ah, agreed; closing this in favor of #763.

@jverkoey jverkoey closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants